package com.itconnect.inc.adapters;

import java.lang.reflect.Field;
import java.lang.reflect.Method;
import java.sql.Date;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.TimeZone;

import org.json.JSONException;

import android.content.Context;
import android.content.Intent;
import android.support.v7.widget.PopupMenu;
import android.support.v7.widget.PopupMenu.OnMenuItemClickListener;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.example.ytc.R;
import com.example.ytc.clazz.ActionButonEvent;
import com.example.ytc.clazz.Video;
import com.example.ytc.tools.FavoritDAO;
import com.example.ytc.tools.Utils;
import com.koushikdutta.urlimageviewhelper.UrlImageViewHelper;

public class DeawerMenuAdapter extends BaseAdapter {

	Context mContext;
	Intent intent;
	LayoutInflater mInflater;
	String[] menu;
	int[] icons={R.drawable.home_icon,
		R.drawable.love_icon,
		R.drawable.about_icon};
	
	public DeawerMenuAdapter(Context context) {
		mContext = context;
		mInflater = (LayoutInflater) mContext
				.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		menu=context.getResources().getStringArray(R.array.menu_drawer);
	}


	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return menu.length;
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return menu[position];
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(final int position, View arg1, ViewGroup arg2) {
		final MenuHolder vh;
		if (arg1 == null) {
			arg1 = mInflater.inflate(R.layout.drawer_mrnu_item, null);
			vh = new MenuHolder();
			vh.txv = (TextView) arg1.findViewById(R.id.menu_txt);
			vh.iv = (ImageView) arg1.findViewById(R.id.img);
			vh.position=position;
			arg1.setTag(vh);
		} else {
			vh = (MenuHolder) arg1.getTag();
		}
		vh.txv.setText(menu[position]);
		vh.iv.setImageResource(icons[position]);
		vh.position=position;
		
		return arg1;
	}



	static class MenuHolder {
		TextView txv;
		ImageView iv;
		int position;
	}
}